package com.tuo51.core.domain.ppp.rel;

import com.tuo51.foudation.model.UnionKey;
import lombok.Data;

import javax.persistence.*;

@Entity
@Data
@Table(name = "rel_staff_product")
public class RelOrgProduct {
    @EmbeddedId
    @AttributeOverrides({@AttributeOverride(name = "domainId", column = @Column(name = "orgId", nullable = false, length = 32)),
            @AttributeOverride(name = "linkId", column = @Column(name = "productId", nullable = false, length = 32))})
    private UnionKey id;


    public static RelOrgProduct of(String orgId, String productId){
        RelOrgProduct rel = new RelOrgProduct();
        rel.setId(UnionKey.of(orgId, productId));
        return rel;
    }
}
